﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace SpyTxT
{
    /*
     * 处理XML数据接口 
     * 
     * 
     */
    public interface IDoXML
    {
        Boolean DoXML(string xmldata);
    }
    public class DoXMLManager
    {
        private ArrayList doxmllist = new ArrayList();
        private ArrayList xmldatalist = new ArrayList();
        public void AddDoXML(IDoXML doxml)
        {
            doxmllist.Add(doxml);
        }
        public void DeleteXML(IDoXML doxml)
        {

            doxmllist.Remove(doxml);
            
        }
        public void DoXMLRun()
        {
            
            if (xmldatalist.Count > 0)
            {
                string xmldata = (string)xmldatalist[0];

                foreach (IDoXML idoxml in doxmllist)
                {
                    if (idoxml.DoXML(xmldata))
                        break;

                }
                xmldatalist.RemoveAt(0);

            }
            
        }
        public void AddXMLData(string xml)
        {
            xmldatalist.Add(xml);

        }
        

    }
}
